package route

import (
	"cms/common"
	"cms/controller"
	"cms/middleware"
	"github.com/kataras/iris"
	"github.com/kataras/iris/mvc"
)

func Routes(app *iris.Application) {
	//登录路由
	mvc.New(app.Party("/")).
		Register(commons.SessManager.Start).
		Handle(new(controllers.IndexController))

	//登录路由
	mvc.New(app.Party("/login")).
		Register(commons.SessManager.Start).
		Handle(new(controllers.LoginController))

	//系统路由
	mvc.New(app.Party("/system", middleware.SessionLoginAuth)).
		Register(commons.SessManager.Start).
		Handle(new(controllers.SystemController))
	//管理员管理
	mvc.New(app.Party("/administrators", middleware.SessionLoginAuth)).
		Register(commons.SessManager.Start).
		Handle(new(controllers.AdministratorsController))
	//分类管理
	mvc.New(app.Party("/categorys", middleware.SessionLoginAuth)).
		Register(commons.SessManager.Start).
		Handle(new(controllers.CategorysController))
	//导航管理
	mvc.New(app.Party("/nav", middleware.SessionLoginAuth)).
		Register(commons.SessManager.Start).
		Handle(new(controllers.NavController))
	//友情管理
	mvc.New(app.Party("/link", middleware.SessionLoginAuth)).
		Register(commons.SessManager.Start).
		Handle(new(controllers.LinkController))
	//系统设置
	mvc.New(app.Party("/setting", middleware.SessionLoginAuth)).
		Register(commons.SessManager.Start).
		Handle(new(controllers.SettingController))
	//广告管理
	mvc.New(app.Party("/adv", middleware.SessionLoginAuth)).
		Register(commons.SessManager.Start).
		Handle(new(controllers.AdvController))
	//申请管理
	mvc.New(app.Party("/applys", middleware.SessionLoginAuth)).
		Register(commons.SessManager.Start).
		Handle(new(controllers.ApplyController))
}
